<div class="main_bd">

    <div class="panel panel_overview">
        <div class="panel__hd">
            <h3 class="panel__title">设置提现信息</h3></div>
        <div class="panel__bd">
            {if $card}
            <form  class="form" action="/amount/upSet" enctype="multipart/form-data" method="post">
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">开户行选择</label>
                    <select required class="form-control  len"  name="bank_id" >
                        {volist name="banks" id="bank"}
                        {if $bank.id==$card.bank_id}
                        <option selected  value="{$bank.id}">{$bank.name}</option>
                        {else}
                        <option  value="{$bank.id}">{$bank.name}</option>
                        {/if}
                        {/volist}
                    </select>
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">开户行网点</label>
                    <input required class="form-control  len" value="{$card.bank_subbranch}"  name="bank_subbranch">
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">用户名称</label>
                    <input required class="form-control  len" value="{$card.bank_username}"  name="bank_username" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">卡号</label>
                    <input required class="form-control  len" value="{$card.bank_num}"  name="bank_num" >
                </div>
                <button class="btn btn_primary">保存更改</button>
            </form>
            {else}
            <form  class="form" action="/amount/addSet" enctype="multipart/form-data" method="post">
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">开户行选择</label>
                    <select required class="form-control  len"  name="bank_id" >
                        {volist name="banks" id="bank"}
                        <option value="{$bank.id}">{$bank.name}</option>
                        {/volist}
                    </select>
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">开户行网点</label>
                    <input required class="form-control  len"  name="bank_subbranch">
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">用户名称</label>
                    <input required class="form-control  len" name="bank_username" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">卡号</label>
                    <input required class="form-control  len"  name="bank_num" >
                </div>
                <button class="btn btn_primary">保存</button>
            </form>
            {/if}


        </div>
    </div>
</div>
<script>


    $(function () {
        $("input[name='image_src']").on("change", function () {

            var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
                var tempStr = "<img class='thumb' width='200px' style='max-height:200px'  />",
                    $label = $('#pic_box');
                $label.find('img.thumb').remove()
                $label.append(tempStr);
                $label.find('img.thumb').attr('src', objUrl);

            }
        });

    });

    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }


    function getStatus(status) {
        if (status == 3) return '已上架'
        if (status == 0) return '未上架'
        return '状态异常';//万一还有其他的呢
    }

    function taggleSatus(id, status) {
        var action = 'up';

        if (status == 0) {
            action = 'down'
        }
        $.post('/mall/' + action, {id: id}, function (res) {
            if (res.code == 1) {
                layer.msg('切换成功');
                grid.draw();

            }
        })
    }

</script>